package com.gupaoedu.baifc.singleton;

/**
 * projectName: baifc_singleton
 * packageName: com.gupaoedu.baifc.singleton
 * Created: 2019/3/12.
 * Auther: baifc
 * Description: ThreadLocal单例
 */
public class ThreadLocalSingleton {

    private ThreadLocalSingleton(){}

    private static final ThreadLocal<ThreadLocalSingleton> threadLocalInstance = new
            ThreadLocal<ThreadLocalSingleton>() {

        @Override
        protected ThreadLocalSingleton initialValue() {
            return new ThreadLocalSingleton();
        }
    };

    public static ThreadLocalSingleton getInstance() {
        return threadLocalInstance.get();
    }
}
